use crate::commands::id::Id;
use crate::storage::Storage;
use crate::ExecuteCommand;
use anyhow::Result;
use clap::Parser;

#[derive(Parser, Debug)]
pub struct Copy {
    /// 待办的id（必填）
    pub id: u32,
}

impl ExecuteCommand for Copy {
    fn execute_command(&self, storage: &impl Storage) -> Result<()> {
        let new_id = storage.cp(self.id)?;
        Id::from(new_id).execute_command(storage)?;
        Ok(())
    }
}